package com.lagou.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class EmailService {

    @Autowired
    JavaMailSender javaMailSender;

    public void sendSimpleMail(String email,String code) {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setSubject("拉勾网站");
        message.setFrom("573955423@qq.com");
        message.setTo(email);
        //message.setCc("37xxxxx37@qq.com");
        //message.setBcc("14xxxxx098@qq.com");
        message.setSentDate(new Date());
        message.setText("您的验证码："+code);
        javaMailSender.send(message);
    }

}
